Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to start mongodb #10

Closed
Kabir1506 opened this issue Apr 3, 2023 · 10 comments
Closed

failed to start mongodb #10

Kabir1506 opened this issue Apr 3, 2023 · 10 comments
Labels
question Further information is requested

Comments

@Kabir1506
Copy link

Kabir1506 commented Apr 3, 2023

getting this error while executing step number 8 from this..
| ERROR | app.db.mongodb:start_async_mongodb:100 - Failed to start mongodb. error=Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed'}
pls help
`1-git clone git@github.com:baoliay2008/lccn_predictor.git
2-cd lccn_predictor

write your mongodb environment config

3-cp config.yaml.template config.yaml
4-vi config.yaml

5-python3.10 -m virtualenv venv/
6-source venv/bin/activate

7-pip3 install -r requirements.txt

8-python main.py
9-uvicorn api.entry:app --host 0.0.0.0 --port 55555`

@baoliay2008
Copy link
Owner

Hello, @Kabir1506. Just a gentle reminder that it's necessary to install MongoDB before proceeding. You can find detailed instructions on how to do this by referring to the MongoDB Installation Tutorials. Version 5.0+ should work.

@Kabir1506
Copy link
Author

Hi @baoliay2008 , I have already installed 6.0.5 version

@baoliay2008
Copy link
Owner

Please check your config.yaml file, for example

mongodb:
  ip: 192.168.1.12
  port: 27017
  username: testing
  password: 'password'
  db: testing

You may verify the authentication configuration of your MongoDB instance by using the ip, port, username, password and db information provided above with the command of ⏎
mongosh --host 192.168.1.12 --port 27017 -u "testing" -p "password" --authenticationDatabase "testing"

@Kabir1506
Copy link
Author

Kabir1506 commented Apr 3, 2023

Now getting this error:
ERROR | app.db.mongodb:start_async_mongodb:100 - Failed to start mongodb. error=quote_from_bytes() expected bytes.
The mongodb server is up..

@baoliay2008
Copy link
Owner

Now getting this error: ERROR | app.db.mongodb:start_async_mongodb:100 - Failed to start mongodb. error=quote_from_bytes() expected bytes. The mongodb server is up..

It seems that the issue might still be with the config.yaml file. My assumption is that you might have entered a numeric password without enclosing it in quotes.

For instance, if your MongoDB password configuration is password: 20230403, the YAML parser will interpret it as a number data type instead of a string. In this case, kindly try using password: "20230403" instead, which should ensure that it gets parsed as a string data type.

@Kabir1506
Copy link
Author

Kabir1506 commented Apr 3, 2023

I have started the mongo server with this command
mongod --port 27017 --dbpath C:\MongoDB\data\db
and have commented username password in config.yml
mongodb: ip: 127.0.0.1 port: 27017 db: lccn

@baoliay2008
Copy link
Owner

Understood, you didn't write the username and password field in config.yml, I see.

To address this, I would recommend updating your config.yml file to include these two fields because it's recommended that you create a separate user account specifically for MongoDB usage, as outlined in the MongoDB Manual.

Alternatively, if you don't want to create a user then you could modify the code to fix the issue.
In your case, deleting L48-L49 and changing L52 from
f"mongodb://{username}:{password}@{ip}:{port}/{db}",
to
f"mongodb://{ip}:{port}/{db}",
might resolve the issue. However, this is just a suggestion and you are welcome to try it out.

@Kabir1506
Copy link
Author

cool thanks alot. Now working on front-end steps

@Kabir1506
Copy link
Author

@baoliay2008 I don't see any dummy contest data in front-end. Is there a way to load dummy data to test and work upon.

@baoliay2008
Copy link
Owner

In the next version, I will include some dummy data.

However, for now, you can still test the functionality by running a very old contest (this is only recommended for temporary testing purposes as the results will be completely inaccurate). To do this, kindly add the following two lines after main.py L13:

    from app.core.schedulers import composed_predict_jobs
    await composed_predict_jobs("biweekly-contest-1")

@baoliay2008 baoliay2008 added the question Further information is requested label Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants